import {get, post, del, put, getURL} from "@/apis/http/request";
import {File} from "@/apis/model/system/FileModel";

/**
 * 得到列表
 * @param params
 */
export const getFileList = (params: any) => get("/file/list", params)

/**
 * 得到分页列表
 * @param params
 */
export const filePage = (params: any) => post("/file/page", params)

/**
 * 删除数据
 * @param id
 * @returns
 */
export const deleteFileById = (id: number) => del("/file/delete/" + id)

/**
 * 新增数据
 * @param param
 */
export const insertFile = (param: File) => post("/file", param)


/**
 * 更新数据
 * @param param
 */
export const updateFile = (param: File) => put("/file", param)

export const uploadFilePath = () => getURL('/file/upload')

/**
 * 上传文件
 * @param data
 */
export const uploadFile = (data: any) => post('/file/upload', data, {
    headers: {
        'Content-Type': 'multipart/form-data'
    }
})
